-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add command param in debug command #9186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add command param in debug command #9186
Conversation
…ntainerapp functions
[Containerapp] `az containerapp function`: Add function key management commands
[Container App] az containerapp function: Add list and show commands for container app functions
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Hi @shivamkm07, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a command parameter to the debug command and introduces a comprehensive set of Azure Function management commands for Azure Container Apps. The primary purpose is to enhance debugging capabilities by allowing custom commands to be passed when establishing debug connections, while also adding new function-related operations for container apps.
- Adds a
commandparameter to thecontainerapp debugcommand for custom debug commands - Introduces new command group
containerapp functionwith list and show operations - Adds function key management commands for listing and updating function and host keys
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
custom.py |
Updates debug function signature to accept command parameter and adds new function management commands |
_ssh_utils.py |
Modifies debug WebSocket connection to handle URL encoding and append command parameter to debug URL |
_params.py |
Adds parameter definitions for all new function-related commands |
commands.py |
Registers new containerapp function command group and subcommands |
_help.py |
Adds comprehensive help documentation for all new function commands |
_clients.py |
Implements API client methods for function operations and key management |
containerapp_functions_decorator.py |
New decorator classes for function list and show operations |
containerapp_function_keys_decorator.py |
New decorator classes for function key management operations |
HISTORY.rst |
Documents the new features in release history |
| class ContainerAppFunctionsPreviewClient: | ||
| api_version = PREVIEW_API_VERSION | ||
|
|
||
| @classmethod | ||
| def list_function_keys(cls, cmd, resource_group_name, name, function_name): | ||
| management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager | ||
| sub_id = get_subscription_id(cmd.cli_ctx) | ||
| url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/functions/{}/listkeys?api-version={}" | ||
| request_url = url_fmt.format( | ||
| management_hostname.strip('/'), | ||
| sub_id, | ||
| resource_group_name, | ||
| name, | ||
| function_name, | ||
| cls.api_version) | ||
|
|
||
| r = send_raw_request(cmd.cli_ctx, "POST", request_url) | ||
| return r.json() | ||
|
|
||
| @classmethod | ||
| def update_function_keys(cls, cmd, resource_group_name, name, function_name, key_name, key_value=None): | ||
| management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager | ||
| sub_id = get_subscription_id(cmd.cli_ctx) | ||
| url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/functions/{}/keys/{}?api-version={}" | ||
| request_url = url_fmt.format( | ||
| management_hostname.strip('/'), | ||
| sub_id, | ||
| resource_group_name, | ||
| name, | ||
| function_name, | ||
| key_name, | ||
| cls.api_version) | ||
|
|
||
| body = {} | ||
| if key_value: | ||
| body["value"] = key_value | ||
|
|
||
| r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(body)) | ||
| return r.json() | ||
|
|
||
| @classmethod | ||
| def list_host_keys(cls, cmd, resource_group_name, name): | ||
| management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager | ||
| sub_id = get_subscription_id(cmd.cli_ctx) | ||
| url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/host/default/listkeys?api-version={}" | ||
| request_url = url_fmt.format( | ||
| management_hostname.strip('/'), | ||
| sub_id, | ||
| resource_group_name, | ||
| name, | ||
| cls.api_version) | ||
|
|
||
| r = send_raw_request(cmd.cli_ctx, "POST", request_url) | ||
| return r.json() | ||
|
|
||
| @classmethod | ||
| def update_host_keys(cls, cmd, resource_group_name, name, key_type, key_name, key_value=None): | ||
| management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager | ||
| sub_id = get_subscription_id(cmd.cli_ctx) | ||
| url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/host/default/{}/{}?api-version={}" | ||
| request_url = url_fmt.format( | ||
| management_hostname.strip('/'), | ||
| sub_id, | ||
| resource_group_name, | ||
| name, | ||
| key_type, | ||
| key_name, | ||
| cls.api_version) | ||
|
|
||
| body = {} | ||
| if key_value: | ||
| body["value"] = key_value | ||
|
|
||
| r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(body)) | ||
| return r.json() |
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate class definition. There's already a ContainerAppFunctionsPreviewClient class defined at line 306. This creates a naming conflict and the second definition will override the first one.
| class ContainerAppFunctionsPreviewClient: | |
| api_version = PREVIEW_API_VERSION | |
| @classmethod | |
| def list_function_keys(cls, cmd, resource_group_name, name, function_name): | |
| management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager | |
| sub_id = get_subscription_id(cmd.cli_ctx) | |
| url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/functions/{}/listkeys?api-version={}" | |
| request_url = url_fmt.format( | |
| management_hostname.strip('/'), | |
| sub_id, | |
| resource_group_name, | |
| name, | |
| function_name, | |
| cls.api_version) | |
| r = send_raw_request(cmd.cli_ctx, "POST", request_url) | |
| return r.json() | |
| @classmethod | |
| def update_function_keys(cls, cmd, resource_group_name, name, function_name, key_name, key_value=None): | |
| management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager | |
| sub_id = get_subscription_id(cmd.cli_ctx) | |
| url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/functions/{}/keys/{}?api-version={}" | |
| request_url = url_fmt.format( | |
| management_hostname.strip('/'), | |
| sub_id, | |
| resource_group_name, | |
| name, | |
| function_name, | |
| key_name, | |
| cls.api_version) | |
| body = {} | |
| if key_value: | |
| body["value"] = key_value | |
| r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(body)) | |
| return r.json() | |
| @classmethod | |
| def list_host_keys(cls, cmd, resource_group_name, name): | |
| management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager | |
| sub_id = get_subscription_id(cmd.cli_ctx) | |
| url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/host/default/listkeys?api-version={}" | |
| request_url = url_fmt.format( | |
| management_hostname.strip('/'), | |
| sub_id, | |
| resource_group_name, | |
| name, | |
| cls.api_version) | |
| r = send_raw_request(cmd.cli_ctx, "POST", request_url) | |
| return r.json() | |
| @classmethod | |
| def update_host_keys(cls, cmd, resource_group_name, name, key_type, key_name, key_value=None): | |
| management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager | |
| sub_id = get_subscription_id(cmd.cli_ctx) | |
| url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/host/default/{}/{}?api-version={}" | |
| request_url = url_fmt.format( | |
| management_hostname.strip('/'), | |
| sub_id, | |
| resource_group_name, | |
| name, | |
| key_type, | |
| key_name, | |
| cls.api_version) | |
| body = {} | |
| if key_value: | |
| body["value"] = key_value | |
| r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(body)) | |
| return r.json() | |
| # Duplicate definition of ContainerAppFunctionsPreviewClient removed to resolve naming conflict. |
| poll_results(cmd, operation_url) | ||
|
|
||
| class ContainerAppFunctionsPreviewClient: | ||
| api_version = PREVIEW_API_VERSION |
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing indentation. This line should be indented to be part of the class definition.
| api_version = PREVIEW_API_VERSION | |
| api_version = PREVIEW_API_VERSION |
| with self.command_group('containerapp function') as g: | ||
| g.custom_command('list-keys', 'list_containerapp_function_keys') | ||
| g.custom_command('update-keys', 'update_containerapp_function_keys') | ||
| g.custom_command('list-hostkeys', 'list_containerapp_function_hostkeys') | ||
| g.custom_command('update-hostkeys', 'update_containerapp_function_hostkeys') |
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate command group definition. The 'containerapp function' command group is already defined at lines 35-37. This will cause conflicts between the two command group definitions.
This PR adds command param in debug command.
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.